package com.ansuenjob.jsonBuilder;

import org.json.JSONException;
import org.json.JSONObject;

import com.ansuenjob.model.Company;
import com.ansuenjob.model.Job;
import com.ansuenjob.model.JobApplyRecord;
import com.ansuenjob.vo.JobApplyRecordVO;

public class JobApplyRecordVOBuilder extends JSONBuilde<JobApplyRecordVO>{

	@Override
	public JobApplyRecordVO buildJson(JSONObject jsonObject) throws JSONException {
		
		JobApplyRecordCompanyBuilder JrBuilder = new JobApplyRecordCompanyBuilder();
		JobApplyRecordJobBuilder JjBuilder = new JobApplyRecordJobBuilder();	
		JobApplyRecordListBuilder JlBuilder = new JobApplyRecordListBuilder();
		
		JSONObject jCompany = jsonObject.getJSONObject("bstCompanyAccount");
		JSONObject jJob	= jsonObject.getJSONObject("bstCompanyJob");
		JSONObject jList = jsonObject.getJSONObject("bstPersonJobApply");
		
		Company company = JrBuilder.buildJson(jCompany);
		Job job = JjBuilder.buildJson(jJob);
		JobApplyRecord personApplyRecord = JlBuilder.buildJson(jList);
		JobApplyRecordVO jobApplyRecordVO = new JobApplyRecordVO(job,company,personApplyRecord);
		return jobApplyRecordVO;
	}

}
